#!/usr/bin/env python
# -*- encoding: utf-8 -*-
'''
@File    :   database.py
@Time    :   2021/02/06 15:31:14
@Author  :   superjin
@Version :   1.0
'''

from typing import Generator, Any
from sqlalchemy import create_engine
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import sessionmaker
from setting.web import settings

engine = create_engine(settings.SQLALCHEMY_DATABASE_URL, pool_pre_ping=True,
                       pool_size=settings.SQLALCHEMY_DATABASE_POOL_SIZE, max_overflow=settings.SQLALCHEMY_DATABASE_MAX_OVERFLOW)
SessionLocal = sessionmaker(autocommit=False, autoflush=False, bind=engine)

Base = declarative_base()
